import fetch from '@/utils/fetch';


// 说明：添加DMA分区
// http://192.168.2.4:8763/flDmaZone
// 接口：api/cb/flDmaZone
// 请求类型：Post
export function addFlDmaZone(obj) {
    return fetch({
        url: 'api/cb/flDmaZone',
        method: 'post',
        data: obj
    });
}

// 说明：删除DMA分区
// 接口：api/cb/flDmaZone/{ids}
// 请求类型：Delete
export function deleteFlDmaZone(idArr) {
    return fetch({
        url: 'api/cb/flDmaZone/' + idArr,
        method: 'delete'
    });
}

// 说明：修改DMA分区
// 接口：api/cb/flDmaZone/{id}
// 请求类型：Put
export function modifyFlDmaZone(id, obj) {
    return fetch({
        url: 'api/cb/flDmaZone/' + id,
        method: 'put',
        data: obj
    })
}

// 说明：DMA分区分页查询(条件搜索)
// 接口：api/cb/flDmaZone/search/{page}/{size}
// 请求类型：Post
export function searchFlDmaZone(page, size, obj) {
    return fetch({
        url: 'api/cb/flDmaZone/search/'+ page +'/'+ size,
        method: 'post',
        data: obj
    });
}

// 说明：获取单个DMA分区
// 接口：api/cb/flDmaZone/{id}
// 请求类型：get
export function getFlDmaZone(id) {
    return fetch({
        url: 'api/cb/flDmaZone/' + id,
        method: 'get'
    })
}


// 导出DMA分区管理Xlsx
// export function exprotXls() {
//     return fetch({
//       url: '/api/cb/flDmaZone/exprotXls',
//       responseType: 'blob',
//       method: 'get'
//     });
//   }
  // POST /flCommunity/exprotXls/{ids}
  // 导出 小区管理
  // 导出小区管理Xlsx
  export function exprotXls(ids,obj) {
    return fetch({
        url: `/api/cb/flDmaZone/exprotXls/${ids}`,
        method: 'post',
        responseType: 'blob',
        data: obj
    })
  }

// 说明：获取区域树--DMA分区资料全部
// 接口：api/cb/flDmaZone/getTree
// 请求类型：Get
export function getTree(){
    return fetch({
        url: 'api/cb/flDmaZone/getTree',
        method: 'get',
    });
}

// 获得DMA分区下绑定的水表
export function findWaterMeterByDmaZoneCode(page,size,obj) {
    return fetch({
      url: `api/cb/flDmaZone/findWaterMeterByDmaZoneCode/${obj}/${page}/${size}`,
      method: 'get'
    });
  }

// 获取未绑定DMA分区的水表
export function findUnbindingWaterMeter(page,size,obj) {
    return fetch({
      url: 'api/cb/flDmaZone/findUnbindingWaterMeter/'+ page +'/'+ size,
      method: 'post',
      data:obj
    });
  }

  // DMA分区和水表绑定
export function binding(zoneCode,obj) {
    return fetch({
      url: `api/cb/flDmaZone/binding/${zoneCode}`,
      method: 'post',
      data:obj
    });
  }

// 解除DMA分区绑定水表
export function removeBinding(meterId) {
    return fetch({
      url: `api/cb/flDmaZone/removeBinding/${meterId}`,
      method: 'post',
    });
  }
